/*
 * ScenarioBuilderImpl.java
 *
 * Created on 21.05.2007, 18:54:51
 */

package logrus.beanmock.scenario;

import java.util.LinkedList;
import java.util.List;

import logrus.beanmock.invoker.MethodInvocationInfo;
import logrus.beanmock.invoker.MethodInvoker;

/**
 * @author serge
 */
public class ScenarioBuilderImpl implements ScenarioBuilder {

    private List<MethodInvocationInfo> infos = new LinkedList<MethodInvocationInfo>();

    public ScenarioBuilderImpl() {
    }

    public void addMethodInvoker(Class<?> targetClass, String targetMethodName,
            MethodInvoker invoker, int min, int max, String scenario) {
        MethodInvocationInfo info = new MethodInvocationInfo(targetClass, targetMethodName,
                invoker, min, max, scenario);
        infos.add(info);
    }

    public Scenario getScenario() {
        return new ScenarioImpl(infos.toArray(EMPTY_ARRAY));
    }

    private final static MethodInvocationInfo[] EMPTY_ARRAY = new MethodInvocationInfo[0];

}
